{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 跟踪车辆 x and y (参考答案)\n",
    "该 notebook 为之前的练习提供了参考答案。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from math import pi\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "# these 2 lines just hide some warning messages.\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "\n",
    "class Vehicle:\n",
    "    def __init__(self):\n",
    "        self.x       = 0.0 # meters\n",
    "        self.y       = 0.0\n",
    "        self.heading = 0.0 # radians\n",
    "        self.history = []\n",
    "        \n",
    "    def drive_forward(self, displacement):\n",
    "        \"\"\"\n",
    "        Updates x and y coordinates of vehicle based on \n",
    "        heading and appends previous (x,y) position to\n",
    "        history.\n",
    "        \"\"\"\n",
    "        delta_x = displacement * np.cos(self.heading)\n",
    "        delta_y = displacement * np.sin(self.heading)\n",
    "        \n",
    "        new_x = self.x + delta_x\n",
    "        new_y = self.y + delta_y\n",
    "        \n",
    "        self.history.append((self.x, self.y))\n",
    "\n",
    "        self.x = new_x\n",
    "        self.y = new_y\n",
    "    \n",
    "    def set_heading(self, heading_in_degrees):\n",
    "        \"\"\"\n",
    "        Set's the current heading (in radians) to a new value\n",
    "        based on heading_in_degrees. Vehicle heading is always\n",
    "        between -pi and pi.\n",
    "        \"\"\"\n",
    "        assert(-180 <= heading_in_degrees <= 180)\n",
    "        rads = (heading_in_degrees * pi / 180) % (2*pi)\n",
    "        self.heading = rads\n",
    "        \n",
    "    def turn(self, degrees):\n",
    "        rads = (degrees * pi / 180)\n",
    "        new_head = self.heading + rads % (2*pi)\n",
    "        self.heading = new_head\n",
    "    \n",
    "    def show_trajectory(self):\n",
    "        \"\"\"\n",
    "        Creates a scatter plot of vehicle's trajectory.\n",
    "        \"\"\"\n",
    "        # get the x and y coordinates from vehicle's history\n",
    "        X = [p[0] for p in self.history]\n",
    "        Y = [p[1] for p in self.history]\n",
    "        \n",
    "        # don't forget to add the CURRENT x and y\n",
    "        X.append(self.x)\n",
    "        Y.append(self.y)\n",
    "        \n",
    "        # create scatter AND plot (to connect the dots)\n",
    "        plt.scatter(X,Y)\n",
    "        plt.plot(X,Y)\n",
    "        \n",
    "        plt.title(\"Vehicle (x, y) Trajectory\")\n",
    "        plt.xlabel(\"X Position\")\n",
    "        plt.ylabel(\"Y Position\")\n",
    "        plt.axes().set_aspect('equal', 'datalim')\n",
    "        plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Your set_heading function looks good!\n",
      "Congratulations! Your vehicle's drive_forward method works\n"
     ]
    }
   ],
   "source": [
    "# Use this testing code to check your code for correctness.\n",
    "from testing import test_drive_forward, test_set_heading\n",
    "\n",
    "test_set_heading(Vehicle)\n",
    "test_drive_forward(Vehicle)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEWCAYAAAB1xKBvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XuUHHWZ//H3J5NAAgkkLMMlE0IgQORqgrNRf9yCQBIiLsjqCu66LOJGdlFB2axcVPa4uujJKuriihEQUIzoLomoXEUR8IJOSCBB7hggMyEZLkkMJJLMPL8/qobtdLpnai7d1dPzeZ3TJ1Xf+nbVU9OZfqbqeylFBGZmZj0ZlncAZmY2ODhhmJlZJk4YZmaWiROGmZll4oRhZmaZOGGYmVkmThhWEyTNkLSqm+1XSfp0hv3cI+lD/YjjV5Km9fX9GY/xZUnnVvIYRcebIemRah3P6pcThg0ISX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7f0S+Mt02+8iYlVEdALLgEm92K9Zn/kKwwyQNBU4ieRpZ/dL+n6Z+Yk2FV8RlLslFBFPpFcfc4DLJd0ZEZ/NGlI32/5csNyBf4+tSnyFYUNe+oX/DZJnEDwHzAf+sxe7uBc4TdJO6ey47wbukzQeeC0ivpvu78gS792STmtdap/vk9QgqRE4FvhdL2IyG3BOGGbwj8BzEXFXuv7fwJskHZflzemjNa8j+UJ/ALg6IpYChwO/S29hXQp8rsTbFwAPdzV6F1gEPAw8BPwc+NeIeKFXZ2U2wNyt1szMMvEVhpmZZeKEYWZmmThhmJlZJk4YZmaWiROGmZll4oRhZmaZOGGYmVkm/x/RBGdeoxO9BwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# instantiate vehicle\n",
    "v = Vehicle()\n",
    "\n",
    "# drive forward 10 meters\n",
    "v.drive_forward(10)\n",
    "\n",
    "# turn left in 10 increments of 9 degrees each.\n",
    "for _ in range(10):\n",
    "    v.turn(9.0)\n",
    "    v.drive_forward(1)\n",
    "\n",
    "v.drive_forward(10)\n",
    "\n",
    "v.show_trajectory()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
